package com.as.tools;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

@Component
public class ArcTools {
	public String createId(){
		String id = "id";
		Date date = new Date();
		SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
		id += df.format(date);
		String rStr = "";
		int a[] = new int[10];
	    for(int i=0;i<a.length;i++ ) {
	        a[i] = (int)(10*(Math.random()));
	        rStr += a[i];
	    }
	    String dStr = String.valueOf(date.getTime());
		id += dStr.substring(dStr.length()-4, dStr.length());
		id += rStr;
		return id;
	}
	public Map<String, String> createProb(int num, int kind){
		Expression ep1 = ProdtEpr.prodE(num, kind);
		Map<String, String> map = new HashMap<String, String>();
		map.put("problem", ep1.epr);
		map.put("ans", ""+ep1.result);
		return map;
	}
}
